#include "Multipole.h"
#include <QPainter>
#include <QStyleOptionGraphicsItem>


//-------------------------------------

Multipole::Multipole()
{
    clr = clMultipoleDef;
    rect = QRectF( 0, 0, DEFAULT_NODE_SIZE, DEFAULT_NODE_SIZE );
    resizingPoints.clear();
    canResize = false;
    isNode = false;
}

//-------------------------------------

QRectF Multipole::boundingRect() const
{
    return rect;
}

//-------------------------------------

void Multipole::paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget )
{
    int shft = 3;
    painter->setPen( clr );
    painter->drawEllipse( rect.topLeft().x()+shft, rect.topLeft().y()+shft, DEFAULT_NODE_SIZE/2, DEFAULT_NODE_SIZE/2 );
    painter->drawEllipse( rect.center().x()-shft, rect.center().x()-shft, DEFAULT_NODE_SIZE/2, DEFAULT_NODE_SIZE/2 );

    if( option->state & QStyle::State_Selected )
    {
        QPen pen = QPen( clSelectDef );
        pen.setStyle( Qt::DashLine );
        pen.setWidth( 0 );
        painter->drawRect( rect );
    }
}

//-------------------------------------
